package control;

import service.GameService;
import ui.JPanelGame;

/**
 * 接受玩家键盘事件
 * 控制画面
 * 控制游戏逻辑
 */
public class GameControl {
    private  JPanelGame panelGame;//游戏控制层
    private GameService gameService;//游戏逻辑层


    public GameControl(JPanelGame panelGame,GameService gameService) {
        this.panelGame = panelGame;
        this.gameService = gameService;
    }




    /**
     * 控制器方向键上
     */
    public void keyUp() {

        this.gameService.keyUp();
        this.panelGame.repaint();
    }

    /**
     * 控制器方向键下
     */
    public void keyDown() {
        this.gameService.keyDown();
        this.panelGame.repaint();
    }

    public void keyLeft() {
        this.gameService.keyLeft();
        this.panelGame.repaint();
    }

    public void keyRight() {
        this.gameService.keyRight();
        this.panelGame.repaint();
    }
}
